using System.ComponentModel.DataAnnotations;
using JGSY.CMS.LowCode.Platform.Infrastructure.Services.Notification;

namespace JGSY.CMS.LowCode.Platform.Infrastructure.Configuration.Models;

// SMS配置已完全迁移到新的企业级SMS服务系统
// 新系统位于: Infrastructure/Services/Notification/SmsService.cs
// 使用 SmsServiceOptions 配置类，支持阿里云、腾讯云、华为云三家提供商
// 具备企业级功能：故障转移、重试机制、频率限制、批量发送、性能监控

#region 已移除的旧SMS配置类
/* 
/// <summary>
/// 短信配置 - 已完全移除，请使用 SmsServiceOptions
/// 迁移说明：
/// 1. 配置文件从 "CacheSettings:Sms" 改为 "SmsService"
/// 2. Provider 从 "both" 改为具体提供商名称如 "aliyun"
/// 3. 支持华为云等更多提供商
/// 4. 具备企业级功能（故障转移、重试、限流等）
/// </summary>
[Removed] public class SmsConfiguration

/// <summary>
/// 阿里云短信配置 - 已完全移除，请使用 AliyunSmsSettings
/// 迁移说明：
/// 1. AccessKeyId, AccessKeySecret 保持不变
/// 2. 新增 Region 字段（默认"cn-hangzhou"）
/// 3. TemplateCode 已移除，使用动态模板ID
/// </summary>
[Removed] public class AliyunSmsConfiguration

/// <summary>
/// 腾讯云短信配置 - 已完全移除，请使用 TencentSmsSettings  
/// 迁移说明：
/// 1. SecretId, SecretKey, SdkAppId 保持不变
/// 2. 新增 Region 字段（默认"ap-beijing"）
/// 3. TemplateId 已移除，使用动态模板ID
/// </summary>
[Removed] public class TencentSmsConfiguration
*/
#endregion

// 配置迁移示例：
/*
// 旧配置格式 (已移除)
{
  "CacheSettings": {
    "Sms": {
      "Provider": "both",
      "Aliyun": { "AccessKeyId": "...", "AccessKeySecret": "..." },
      "Tencent": { "SecretId": "...", "SecretKey": "..." }
    }
  }
}

// 新配置格式 (当前使用)
{
  "SmsService": {
    "DefaultProvider": "aliyun",
    "EnableFailover": true,
    "RetryCount": 3,
    "EnableRateLimit": true,
    "MaxSendPerMinute": 60,
    "MaxSendPerHourPerPhone": 10,
    "Aliyun": {
      "AccessKeyId": "your-key",
      "AccessKeySecret": "your-secret", 
      "Region": "cn-hangzhou",
      "SignName": "您的签名"
    },
    "Tencent": {
      "SecretId": "your-id",
      "SecretKey": "your-key",
      "Region": "ap-beijing", 
      "SdkAppId": "your-app-id",
      "SignName": "您的签名"
    },
    "Huawei": {
      "AccessKeyId": "your-key",
      "SecretAccessKey": "your-secret",
      "Region": "cn-north-4",
      "ProjectId": "your-project-id",
      "ChannelNumber": "your-channel",
      "SignName": "您的签名"
    }
  }
}
*/

/// <summary>
/// 文件上传配置
/// </summary>
public class UploadConfiguration
{
    [Required]
    public string StorageType { get; set; } = "Local";
    
    [Required]
    public string UploadPath { get; set; } = "wwwroot/uploads";
    
    [Required]
    public string BaseUrl { get; set; } = "https://localhost:7001";
    
    [Range(1, long.MaxValue, ErrorMessage = "Max file size must be greater than 0")]
    public long MaxFileSize { get; set; } = 52428800; // 50MB
    
    [Required]
    public List<string> AllowedExtensions { get; set; } = new()
    {
        // 图片文件
        ".jpg", ".jpeg", ".png", ".gif", ".bmp", ".webp", ".svg", ".ico", ".tiff", ".tif",
        
        // 文档文件
        ".pdf", ".doc", ".docx", ".xls", ".xlsx", ".ppt", ".pptx", ".txt", ".rtf", 
        ".odt", ".ods", ".odp", ".pages", ".numbers", ".key",
        
        // 压缩文件
        ".zip", ".rar", ".7z", ".tar", ".gz", ".bz2", ".xz",
        
        // 音频文件
        ".mp3", ".wav", ".aac", ".ogg", ".m4a", ".flac", ".wma",
        
        // 视频文件
        ".mp4", ".avi", ".mov", ".wmv", ".flv", ".webm", ".mkv", ".m4v", ".3gp",
        
        // 代码文件
        ".cs", ".js", ".ts", ".html", ".htm", ".css", ".scss", ".sass", ".less",
        ".json", ".xml", ".yaml", ".yml", ".md", ".py", ".java", ".php", ".go", ".rs",
        
        // CAD/设计文件
        ".dwg", ".dxf", ".step", ".stp", ".iges", ".igs", ".stl", ".obj",
        ".psd", ".ai", ".eps", ".cdr", ".sketch"
    };
    
    public List<string> ImageExtensions { get; set; } = new()
    {
        ".jpg", ".jpeg", ".png", ".gif", ".bmp", ".webp", ".svg", ".ico", ".tiff", ".tif"
    };
    
    public LocalStorageConfiguration Local { get; set; } = new();
}

/// <summary>
/// 本地存储配置
/// </summary>
public class LocalStorageConfiguration
{
    [Required]
    public string RootPath { get; set; } = "wwwroot/uploads";
    
    [Required]
    public string BaseUrl { get; set; } = "/uploads";
}
